// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import util from 'util'
import io from 'api/io'
import storage from 'storage'
//  import Vconsole from 'vconsole'
//  new Vconsole()
import Mint from 'mint-ui';
import 'mint-ui/lib/style.css'
Vue.use(Mint);
import './assets/common.css'
import { Toast,MessageBox } from 'mint-ui';
window.Toast=Toast
window.MessageBox=MessageBox
// import FastClick from 'fastclick'
// FastClick.attach(document.body);
Vue.config.productionTip = false

router.beforeEach(async(to, from, next) => {
  console.log(to)
  // 统计代码
  if (to.path) {
    _hmt.push(['_trackPageview', '/#' + to.fullPath]);
  }
    document.title = to.meta.title||to.query.title||'呼吸英语'
   if(!storage.getAccessToken()&&to.path!=='/login'){
     next('/login')
   }
  next()
})
let grade=[{id:1,name:'一年级'},{id:2,name:'二年级'},{id:3,name:'三年级'},{id:4,name:'四年级'},{id:5,name:'五年级'},{id:6,name:'六年级'},{id:7,name:'初一'},{id:8,name:'初二'},{id:9,name:'初三'},{id:10,name:'高一'},{id:11,name:'高二'},{id:12,name:'高三'}]

export default router
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  data:{grade:grade}
})
